class boundingBox
{
  public vec2d tl, br; // topleft and bottom right

  boundingBox()
  {
    this.tl = new vec2d(0, 0);
    this.br = new vec2d(0, 0);
  }

  boundingBox(float x1, float y1, float x2, float y2)
  {
    this.tl = new vec2d(x1,y1);
    this.br = new vec2d(x2, y2);
  }

  boundingBox(vec2d tl, vec2d br)
  {
    this.tl = new vec2d(tl);
    this.br = new vec2d(br);
  }

  boolean isPointInBox(float x, float y)
  {
    if( (x > this.tl.x) && (x < this.br.x) )
    {
      if(  (y > this.tl.y) && (y < this.br.y) )
      {
        return true;
      }
    }
    return false;

  }

  void move(float x, float y)
  {
    this.tl.x += x;
    this.tl.y += y;

    this.br.x += x;
    this.br.y += y; 

  }

  void moveTo(float x, float y)
  {
    float cenX = this.br.x - ((this.br.x - this.tl.x)/2);
    float cenY = this.br.y - ((this.br.y - this.tl.y)/2);

    float dX = cenX -  x;
    float dY = cenY - y;

    this.move(-dX, -dY);
  }

  public void draw(float x, float y)
  {
    stroke(200,0,0);
    fill(0,0);

    rect(this.tl.x + x, this.tl.y + y, this.br.x - this.tl.x, this.br.y - this.tl.y);
  }
}
